﻿/* Write a program to convert from any numeral system of given base s to any other numeral system of base d (2 ≤ s, d ≤  16). */

using System;

class AnyNumeral
{
    static void Main()
    {
        Console.WriteLine(@"
        This program converts from any numeral system of given base 
        to any other numeral system of base d (2 <= s, d <=  16).");
        Console.Write("Please enter numeral base from which you want to convert: ");
        Int32 source_nb = Int32.Parse(Console.ReadLine()); //source numeral base
        Console.Write("Please enter numeral base to which you want to convert: ");
        Int32 dest_nb = Int32.Parse(Console.ReadLine()); //destination numeral base
        Console.Write("Please enter the number you want to convert: ");
        string number = Console.ReadLine();
        string result = Convert.ToString(Convert.ToInt64(number, source_nb), dest_nb);
        Console.WriteLine("The representation of the number {0} from a {1}-base numeral system to {2}-base numeral system is: {3}", number, source_nb, dest_nb, result);
    }
}
